﻿using System;

class QuadraticEquation
{
    static void Main()
    {
        Console.WriteLine("A program for solving quadratic equations ax2+bx+c=0\r\n");
        Console.Write("Please enter coefficient a: ");
        string consoleInput = Console.ReadLine();
        int a = int.Parse(consoleInput);
        Console.Write("Please enter coefficient b: ");
        consoleInput = Console.ReadLine();
        int b = int.Parse(consoleInput);
        Console.Write("Please enter coefficient c: ");
        consoleInput = Console.ReadLine();
        int c = int.Parse(consoleInput);
        double result = b * b - 4 * a * c;
        double x1, x2;
        if (result < 0)
        {
            Console.WriteLine("The equation has no real roots.");
        }
        else if (result == 0)
        {
            x1 = -b / (2 * a);
            Console.WriteLine("The equation has one real root - x1 = x2 = {0:0.0000}", x1);
        }
        else
        {
            x1 = (-b + Math.Sqrt(result)) / (2 * a);
            x2 = (-b - Math.Sqrt(result)) / (2 * a);
            Console.WriteLine("The equation has two real roots - x1 = {0:0.0000} and x2 = {1:0.0000}", x1, x2);
        }
    }
}
